#include "GameWorld.h"
#include <cmath>
#include "Terrain.h"
#include "BaseEntity.h"
#include "GlobalDefines.h"
#include ".\gameobject.h"
#include ".\Model.h"
#include "Player.h"
#include "DebugGrid.h"
#include "Enemy.h"
#include "MessageHandler.h"
#include "DXConsole.h"


GameWorld::GameWorld()
{
	EntMgr->createGameObjects();
	m_game = false;
}

GameWorld::~GameWorld()
{

}

void GameWorld::loadSounds()
{
	SoundBuff = dxAmgr.LoadWaveToSoundBuffer("AsianDance.wav");
}

bool GameWorld::checkSounds()
{
	if (!SoundBuff)
	{
		return false;
	}

	return true;
}

void GameWorld::playbckgrnd()
{
	dxAmgr.playSoundLoop(SoundBuff);
}

void GameWorld::releaseSounds()
{
	if (SoundBuff)
	{
		SoundBuff->Release();
		SoundBuff = NULL;
	}
}

void GameWorld::update(float a_dt)
{
	EntMgr->update(a_dt);
}

void GameWorld::render()
{
	EntMgr->draw();
}

void GameWorld::WorldInput()
{
	EntMgr->EntInput();
}

void GameWorld::shutDown()
{
	EntMgr->shutDown();
	dxMgr.shutdown();
	dxAmgr.shutdownDirectSound();
}

bool GameWorld::GameOver()
{
	if(EntMgr->gameOver() == true)
	{
		m_game = true;
	}

	return m_game;
}